<?php

namespace app\model\questionnaire;

use app\BaseModel;
use think\model\relation\BelongsTo;

/**
 * 问卷-任务-试卷
 */
class QuestionnaireTaskPaperModel extends BaseModel
{
    protected $name = 'questionnaire_task_paper';

    /**
     * 试卷
     * @return BelongsTo
     */
    public function paper(): BelongsTo
    {
        return $this->belongsTo(QuestionnairePaperModel::class,'paper_id')->bind([
            'paper_name'=>'name',
            'paper_type_name' => 'type_name',
            'time_limited',
            'total_score',
            'topic_num'
        ]);
    }

    /**
     * 关联任务
     * @return BelongsTo
     */
    public function task(): BelongsTo
    {
        return $this->belongsTo(QuestionnaireTaskModel::class,'task_id')->bind([
            'task_name'=>'name',
            'task_user_num'=>'user_num',
            'task_user_complete_num'=>'user_complete_num'
        ]);
    }
}